Arm/optee: don't open-code xzalloc_flex_struct()
authorJan Beulich <jbeulich@suse.com>
Fri, 7 May 2021 08:45:14 +0000 (10:45 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 7 May 2021 08:45:14 +0000 (10:45 +0200)
commit7a2b787880bddbb3bd68b18efe1d6fe339df6ff1
tree5c0d05afe197aaca9e69a9bd614e6a2a53058955
parent472a13988a051e5ae84b95815c6caf4378062abe
Arm/optee: don't open-code xzalloc_flex_struct()

The current use of xzalloc_bytes() in optee is nearly an open-coded
version  of xzalloc_flex_struct(), which was introduced after the driver
was merged.

The main difference is xzalloc_bytes() will also force the allocation to
be SMP_CACHE_BYTES aligned and therefore avoid sharing the cache line.
While sharing the cache line can have an impact on the performance, this
is also true for most of the other users of x*alloc(), x*alloc_array(),
and x*alloc_flex_struct(). So if we want to prevent sharing cache lines,
arranging for this should be done in the allocator itself.

In this case, we don't need stricter alignment than what the allocator
provides. Hence replace the call to xzalloc_bytes() with one of
xzalloc_flex_struct().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Julien Grall <julien@xen.org>
Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
xen/arch/arm/tee/optee.c